package com.newviews.tcmip.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.newviews.tcmip.pojo.po.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.newviews.tcmip.web.vo.etcmingr.EtcmBarChartVo;
import com.newviews.tcmip.web.vo.etcmingr.EtcmScatterDiagramVo;
import com.newviews.tcmip.web.vo.etcmingr.EtcmVolcanoMapVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 组成成分扩展信息 Mapper 接口
 * </p>
 *
 * @author lxc
 * @since 2024-03-01
 */
public interface EtcmIngrExMapper extends BaseMapper<EtcmIngrExPo> {

    IPage<EtcmIngrExPo> getPage(Page<EtcmIngrExPo> page,@Param(Constants.WRAPPER) QueryWrapper<EtcmIngrExPo> wrapper);

    IPage<EtcmHerbPo> getPageByHerb(Page<EtcmHerbPo> objectPage,@Param(Constants.WRAPPER) QueryWrapper<EtcmHerbPo> wrapper);

    IPage<EtcmPxPo> getPageByPx(Page<EtcmPxPo> objectPage,@Param(Constants.WRAPPER) QueryWrapper<EtcmPxPo> wrapper);

    List<EtcmIngrDiseasePo> getPageByAssociatedDiseases(@Param(Constants.WRAPPER) QueryWrapper<EtcmIngrDiseasePo> wrapper);

    List<EtcmIngrExPo> getList(@Param(Constants.WRAPPER) QueryWrapper<EtcmIngrExPo> like);

    List<EtcmHerbPo> getListByHerb(@Param(Constants.WRAPPER) QueryWrapper<EtcmHerbPo> wrapper);

    List<EtcmPxPo> getListByPx(@Param(Constants.WRAPPER) QueryWrapper<EtcmPxPo> wrapper);

    List<EtcmDiseasePo> getListByAssociatedDiseases(@Param(Constants.WRAPPER) QueryWrapper<EtcmDiseasePo> wrapper);

    IPage<EtcmIngrPo> getPageByProperty(Page<EtcmIngrPo> objectPage,@Param(Constants.WRAPPER) QueryWrapper<EtcmIngrPo> wrapper);

    List<String> getStatistics(@Param(Constants.WRAPPER) QueryWrapper<String> wrapper);

    IPage<EtcmIngrTargetPo> getPageByTarget(Page<EtcmTargetPo> objectPage,@Param(Constants.WRAPPER) QueryWrapper<EtcmIngrPo> wrapper);

    List<EtcmTargetPo> getTargetList(@Param(Constants.WRAPPER) QueryWrapper<EtcmTargetPo> wrapper);

    List<EtcmIngrIngrPo> getPageBySynergisticIngredients(@Param(Constants.WRAPPER) QueryWrapper<EtcmIngrIngrPo> wrapper);

    List<EtcmIngrPo> getStatisticsIngr(QueryWrapper<EtcmIngrPo> wrapper);

    List<EtcmIngrTargetPo> getTargetDownload(@Param(Constants.WRAPPER) QueryWrapper<EtcmIngrPo> wrapper);

    List<EtcmPxExPo> downloadPx(@Param(Constants.WRAPPER) QueryWrapper<EtcmPxPo> wrapper, @Param("uiTypeCode") String uiTypeCode, @Param("langCode") String langCode);

    List<EtcmHerbExPo> getHerbDownload(@Param(Constants.WRAPPER) QueryWrapper<EtcmHerbExPo> wrapper, @Param("uiTypeCode") String uiTypeCode, @Param("langCode") String langCode);

    List<EtcmIngrExPo> downloadIngredient(@Param(Constants.WRAPPER) QueryWrapper<EtcmHerbExPo> wrapper);

    IPage<EtcmIngrPo> getIngrPage(Page<Object> objectPage,@Param(Constants.WRAPPER) QueryWrapper<EtcmIngrPo> wrapper);

    IPage<EtcmExperimentalRecordsIngrPo> getPageEr(Page page,@Param(Constants.WRAPPER) QueryWrapper<EtcmExperimentalRecordsPo> wrapper);

    List<EtcmExperimentalRecordsIngrPo> getListErDownload(@Param(Constants.WRAPPER) QueryWrapper<EtcmExperimentalRecordsPo> wrapper);
    @Select("SELECT DISTINCT er_id,genesymbol,name,log_fc,significance FROM etcm_experimental_volcano_map WHERE er_id = #{erId} and name >= 0 and name <= 188")
    List<EtcmVolcanoMapVo> getVolcanoMap(@Param("erId") String erId);
    @Select("SELECT DISTINCT ontology,gene_ratio,description,p_adjust,count FROM etcm_experimental_scatter_diagram WHERE er_id = #{erId} and ontology = 'BP'  and count >= 4 and  count <= 49 and p_adjust >= 1.85e-14 and p_adjust <= 0.009361377 limit 100")
    List<EtcmScatterDiagramVo> getScatterDiagramBp(@Param("erId") String erId);

    @Select("SELECT DISTINCT ontology,gene_ratio,description,p_adjust,count FROM etcm_experimental_scatter_diagram WHERE er_id = #{erId} and ontology = 'CC'  and count >= 4 and  count <= 49 and p_adjust >= 1.85e-14 and p_adjust <= 0.009361377 limit 100")
    List<EtcmScatterDiagramVo> getScatterDiagramCc(@Param("erId") String erId);

    @Select("SELECT DISTINCT ontology,gene_ratio,description,p_adjust,count FROM etcm_experimental_scatter_diagram WHERE er_id = #{erId} and ontology = 'MF' and count >= 4 and  count <= 49 and p_adjust >= 1.85e-14 and p_adjust <= 0.009361377  limit 100")
    List<EtcmScatterDiagramVo> getScatterDiagramMf(@Param("erId") String erId);

    @Select("SELECT  ontology,gene_ratio,description,p_adjust,count FROM etcm_experimental_scatter_diagram WHERE er_id = #{erId} and count >= 4 and  count <= 49 and p_adjust >= 1.85e-14 and p_adjust <= 0.009361377")
    List<EtcmScatterDiagramVo> getScatterDiagram(@Param("erId") String erId);
    @Select("SELECT DISTINCT description,p_adjust,count FROM etcm_experimental_bar_chart WHERE er_id = #{erId} and p_adjust >= 2.82e-15 and p_adjust <= 0.994625688")
    List<EtcmBarChartVo> getBarChart(@Param("erId") String erId);
}
